package com.masterclient.app.businessmodule.minemodule.message

import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.eoner.baselib.widget.navgation.FCNavigationBar
import com.eoner.baselibrary.bean.personal.MessageCenterBean
import com.eoner.middlelib.router.map.FCRouterPath
import com.masterclient.app.R
import com.masterclient.app.base.FCBusinessActivity
import com.masterclient.app.businessmodule.minemodule.message.adapter.MsgCenterAdapter
import com.masterclient.app.businessmodule.minemodule.message.contract.MessageContract
import com.masterclient.app.businessmodule.minemodule.message.contract.MessagePresenter
import kotlinx.android.synthetic.main.activity_msg_center.*

/**
 * 作者：sean
 * 创建时间：2018/5/22 16:09
 * 功能说明：
 */
@Route(path = FCRouterPath.MINE_MESSAGE_PATH)
class MessageActivity :FCBusinessActivity<MessagePresenter>(), MessageContract.View{

    var msgCenterAdapter = MsgCenterAdapter()

    override fun requireGetLayoutId(): Int {
        return R.layout.activity_msg_center
    }

    override fun requireSetCustomNavigationBar(navigationBar: FCNavigationBar?) {
        navigationBar?.setTitle("消息中心")?.setLineHidden(true)
    }

    override fun requireInitUIAndData(savedInstanceState: Bundle?) {
        recyclerView.layoutManager = LinearLayoutManager(this)
        recyclerView.adapter = msgCenterAdapter
    }


    override fun showData(list: MutableList<MessageCenterBean.MsgItem>) {
        msgCenterAdapter.setNewData(list)
    }

    override fun onResume() {
        super.onResume()
        mPresenter.getMessageCenter()
        msgCenterAdapter.notifyDataSetChanged()
    }

    override fun onClickPageStateErrorView() {
        super.onClickPageStateErrorView()
        mPresenter.getMessageCenter()
    }

}